package com.cssy.xxkj.logic.dao.impl;

import java.util.List;

import org.springframework.dao.DataAccessException;
import org.springframework.orm.ibatis.support.SqlMapClientDaoSupport;

import com.cssy.xxkj.logic.dao.LogicPayDAO;
import com.cssy.xxkj.logic.entity.LogicPayDO;
import com.plat.helper.SearchConditions;

/**
 * 数据访问对象实现类
 * @since 2014-10-08
 */
public class LogicPayDAOImpl extends SqlMapClientDaoSupport implements LogicPayDAO {

    /**
     * 插入数据
     * @param logicPayDO
     * @return 插入数据的主键
     */
    public String insertLogicPayDO(LogicPayDO logicPayDO) throws DataAccessException {
        Object id = getSqlMapClientTemplate().insert("LogicPay.insert", logicPayDO);
        return (String) id;
    }

    /**
     * 统计记录数
     * @param logicPayDO
     * @return 查出的记录数
     */
    public Integer countLogicPayDOByExample(LogicPayDO logicPayDO) throws DataAccessException {
        Integer count = (Integer) getSqlMapClientTemplate().queryForObject("LogicPay.countByDOExample", logicPayDO);
        return count;
    }

    /**
     * 更新记录
     * @param logicPayDO
     * @return 受影响的行数
     */
    public Integer updateLogicPayDO(LogicPayDO logicPayDO) throws DataAccessException {
        int result = getSqlMapClientTemplate().update("LogicPay.update", logicPayDO);
        return result;
    }

    /**
     * 获取对象列表
     * @param logicPayDO
     * @return 对象列表
     */
    @SuppressWarnings("unchecked")
    public List<LogicPayDO> findListByExample(LogicPayDO logicPayDO) throws DataAccessException {
        List<LogicPayDO> list = getSqlMapClientTemplate().queryForList("LogicPay.findListByDO", logicPayDO);
        return list;
    }

    /**
     * 根据主键获取logicPayDO
     * @param id
     * @return logicPayDO
     */
    public LogicPayDO findLogicPayDOByPrimaryKey(String id) throws DataAccessException {
        LogicPayDO logicPayDO = (LogicPayDO) getSqlMapClientTemplate().queryForObject("LogicPay.findByPrimaryKey", id);
        return logicPayDO;
    }

    /**
     * 删除记录
     * @param id
     * @return 受影响的行数
     */
    public Integer deleteLogicPayDOByPrimaryKey(String id) throws DataAccessException {
        Integer rows = (Integer) getSqlMapClientTemplate().delete("LogicPay.deleteByPrimaryKey", id);
        return rows;
    }
    @SuppressWarnings("unchecked")
	@Override
	public List<LogicPayDO> find(SearchConditions scs)
			throws DataAccessException {
    	    List<LogicPayDO> list=getSqlMapClientTemplate().queryForList("LogicPay_ex.find",scs);
		return list;
	}

	@Override
	public Integer count(SearchConditions scs) throws DataAccessException {
		Integer count=(Integer)getSqlMapClientTemplate().queryForObject("LogicPay_ex.count",scs);
		return count;
	}

	@Override
	public Double findLastedDOByOricode(SearchConditions scs)
			throws DataAccessException {
		Double yfhk = (Double) getSqlMapClientTemplate().queryForObject("LogicPay_ex.findLastedDOByOricode", scs);
		return yfhk;
	}

	@Override
	public Integer deleteBizRemoved(String id) throws DataAccessException {
		Integer count = (Integer) getSqlMapClientTemplate().update("LogicPay_ex.deleteBizRemoved", id);
        return count;
	}

}